<html>
  <head>
    <script src="../closure-library/closure/goog/base.js"></script>
    <script src="jsmeta.js"></script>
    <script>
      goog.require('jsmeta.javascript');
    </script>
    <script>
function RunProgram() {
  //                        0123456789
  var r = JavaScript.parse("var b,b,b");
  
  var j2 = new Grammar("j2");

  var rules = {
    "top" : function(r) { with(r) {
      return both(call("A"),end());
    }},
    "A" : function(r) { with(r) {
      return alt(seq(call("A"),lit(','),lit('a')),lit('a'));
      return alt(lit('a'),seq(call("A"),lit(','),lit('a')));
    }}
  };

  for (var i in rules) {
    j2.addRule(i, rules[i](j2.combinators));
  }
   
  //j2.parse("aaa");
  //j2.parse("a,a,a");
}
    </script>
  </head>
  <body onload="RunProgram()">
  </body>
</html>